#include "DrawManager.h"
#include "StaticsManager.h"
#include "CharacterManager.h"
#include <iostream>
#include <cassert>
#include <algorithm>


DrawManager::DrawManager(){
    SubManager *staticsManager = new StaticsManager();
    SubManager *charManager = new CharacterManager();
    mManagers[STATIC] = staticsManager;
    mManagers[CHAR] = charManager;
}

void DrawManager::drawAll(BITMAP *pScreen) {
  std::map<EntityType, SubManager *>::iterator p;
  
  for(p = mManagers.begin(); p != mManagers.end(); p++) {
    p->second->drawAll(pScreen); 
  }
}

void DrawManager::addEntity(Entity *pEntity, EntityType type) {
    assert(pEntity != NULL);
    mManagers[type]->addEntity(pEntity);
}

void DrawManager::removeEntity(Entity *pEntity) {/*
    assert(pEntity != NULL);
    list<Entity*>::iterator it = 
        find(mEntities.begin(), mEntities.end(), pEntity);
    
    if(it != mEntities.end()) {
        cout << "removing Entity from DrawManager" << endl;
        mEntities.erase(it);
    }
    else
        cout << "Could not find entity in list" << endl;
        

*/}

int DrawManager::getCount() {
    SubManager * manager = mManagers[STATIC];
    return manager->getCount();
}
